This invention relates to a system for exclusively controlling each of resources in an electronic digital computer system.
In an electronic digital computer system, a wide variety of resources are used to process tasks or jobs determined by programs. Among such resources, there are specific resources, such as I/O devices, files, data, programs, and the like, such that inconvenience is caused to occur when a plurality of programs or tasks are concurrently processed by the use of a common one of the specific resources. In order to prevent the inconvenience in the specific resources, exclusive control is carried out such that each specific resource is put into a locked state when a lock request is issued from a program to one of the specific resources. During the locked state, only the program in question can exclusively use the one of the specific resources while the other programs are prohibited from use of the one of the specific resources. Thus, each specific resource is exclusively occupied by the program.
To this end, the electronic digital computer system is provided with a system which exclusively controls each resource and which will be called an exclusive control system hereinunder. More specifically, the exclusive control system puts each resource into the locked state or occupied state in response to the lock request issued from each program. As a result, each resource is not available in the locked state by the other programs.
On the other hand, let the lock request be issued from a certain program to a particular one of the resources while the particular resource is kept in an unlocked state. In this event, the particular resource becomes available by the certain program under control of the exclusive control system. In other words, the exclusive control system permits the certain program to use the particular resource and puts the same into the locked state. Thereafter, the locked state of the particular resource is released or unlocked in response to a lock release request which is issued from the certain program when the particular resource becomes unnecessary.
Herein, consideration must be made in such an exclusive control system about occurrence of a deadlock. More particularly, such a deadlock takes place either in the case where a certain resource is already occupied or locked by a certain program while another program which occupies another resource intends to occupy or lock the certain program or in the case where a program waits for a resource which is already occupied or locked by another program. In this situation, the resources are forever kept into a waiting state or an inactive state as long as a deadlock is continued.
In order to avoid such a deadlock, proposal has been made about a method of previously determining an order of locking and releasing the resources.
It is assumed that first and second ones of the resources are successively used during preselected processing in the order of the first resource and the second resource. In this event, the first resource is at first exclusively occupied and thereafter the second resource is exclusively occupied. Specifically, when a certain program exclusively occupies the first resource and thereafter occupies the second resource, no deadlock takes place because another program that already exclusively occupies the second resource is never put into a state of waiting for the first resource.
In the meanwhile, it is necessary to shorten an occupation time so as to effectively utilize a restricted number of resources. For this purpose, each resource is divided into a plurality of partial resources or subdivisions which are individually put into the locked states. In this case, locking and releasing are carried out in response to a lock request and a lock release request in a predetermined order to lock and release the subdivisions and to prevent occurrence of the deadlock.
At any rate, the predetermined order is determined so as to avoid occurrence of the deadlock. However, a lock request and a lock release request should be issued from the programs. With this structure, occurrence of the deadlock can not be always effectively prevented when the resources are locked or released in a wrong order due to errors which occur in the programs. Accordingly, an excessive load is imposed on coding the programs so as to remove such errors from the programs. However, it is difficult to completely remove the errors from the programs. As a result, the errors are likely to occur when the lock and the lock release requests are issued from the programs.